package com.ys.web.user.friends.mapper;

import com.ys.base.BaseMapper;
import com.ys.web.user.friends.po.BaseGroupInfoPO;
import com.ys.web.user.friends.po.GroupCapacityRecord;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author quxinjun
 * @version 1.0.0
 * @ClassName GroupInfoMapper.java
 * @Description GroupInfoMapper
 * @createTime 2021年05月13日 19:44:00
 */
@Mapper
public interface GroupInfoMapper extends BaseMapper<BaseGroupInfoPO> {

    /**
     * @param uid 用户id
     * @title findUserGroupListById
     * @description 获取用户所有群的信息
     * @author quxinjun
     * @updateTime 2021/5/19 17:43
     * @return: java.util.List<com.ys.web.user.friends.po.BaseGroupInfoPO>
     */
    List<BaseGroupInfoPO> findUserGroupListById(Long uid);

    /**
     * @param id 组id
     * @throws
     * @title deleteGroupInfo
     * @description 删除组信息（逻辑删除）
     * @author quxinjun
     * @updateTime 2021/5/19 20:52
     * @return: int
     */
    int deleteGroupInfo(@Param("groupId") Long id);

    /**
     * @title selectEffectiveGroupInfo
     * @description 获取有效的组信息
     * @author quxinjun
     * @updateTime 2021/6/4 17:14
     * @return: java.util.List<com.ys.web.user.friends.po.BaseGroupInfoPO>
     */
    List<BaseGroupInfoPO> selectEffectiveGroupInfo();

    /**
     * @title insertObj
     * @author quxinjun
     * @updateTime 2021/6/10 20:46
     * @return: java.lang.Long
     */
    Long insertObj(@Param("entity") BaseGroupInfoPO baseGroupInfoPO);


    /**
     * 注册用户添加 邀请码信息
     *
     * @param userId  注册人id
     * @param invite  邀请码
     * @param groupId 群id
     */
    void insertInviteInfo(@Param("userId") Long userId, @Param("inviteCode") String invite, @Param("groupId") long groupId);

    /**
     * 添加扩容记录
     *
     * @param groupId 群id
     * @param uid     操作人id
     */
    void insertRecord(@Param("groupId") String groupId, @Param("uid") Long uid);

    /**
     * 获取所有扩容后的有效群聊信息
     *
     * @param initPersonSize
     * @return
     */
    List<BaseGroupInfoPO> selectChangeCapacityGroupList(@Param("initPersonSize") String initPersonSize);

    List<GroupCapacityRecord> getCapacityRecordList();

    /**
     * 查询用户有效群的个数
     * @param uid
     * @return
     */
    int selectUserUse(@Param("uid") Long uid);

    int userGroupNumber(@Param("uid")long uid);

    int groupUserBlack(@Param("uid")long uid, @Param("groupId")String groupId, @Param("blackUid")long blackUid);

    int groupUserBlackUn(@Param("uid")long uid, @Param("groupId")String groupId, @Param("blackUid")long blackUid);

    int groupUserBlackCount(@Param("uid")long uid,@Param("groupId")String groupId);

    int groupUserByidBlackCount(@Param("uid")long uid);
}
